package com.work.config;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

@Setter
@Getter
@Configuration
@ConfigurationProperties(prefix = "auth")
public class AuthConfig {

    private JwtAuth jwtAuth = new JwtAuth();

    @Getter
    @Setter
    public static class JwtAuth {
        //        基础单位秒
        //    账户令牌过期时间
        private Long accessTokenExpire = 3600L;
        //    刷新令牌过期时间
        private Long refreshTokenExpire = 86400L;
        //    令牌header名称
        private String header = "Authorization";
        //    令牌前缀
        private String headerPrefix = "Bearer ";

        public Long getAccessTokenExpire() {
            return accessTokenExpire * 1000;
        }

        public Long getRefreshTokenExpire() {
            return refreshTokenExpire * 1000;
        }
    }
}
